An electromagnet of this kind is known from document EP 1 818 951 B1. The magnetic return path between the pole piece and the magnetic piston are of considerable importance for the operating properties of such magnets. The property of this return path depends on the configuration of the air gap located between the magnetic piston and the pole piece. Generally, a small air gap between the magnetic piston and the pole piece results in an increase in the magnetic force over stroke. This document discloses a number of solutions for the geometric design of the air gap that are based on measures for shaping the magnetic piston on its end adjacent to the aperture opening on the pole piece. These solutions involve tapered surfaces at the end section of the piston or a shortening of the length of the piston in such a way that its end surface does not totally extend through the aperture opening.